Some of these tests will work even without support of ACM by Xen.
-Several of these tests require the privilege of being allowed to label
-resources and will otherwise be skipped. By default the test suite
+The xm test suite has been extended to support labeling of resources
+as required by the existing tests. However, by default the test suite
is not allowed to automatically label resources since this may affect
existing labels. To enable this, the test suite must be configured with
the following parameter passed to the configure scripts (in addition to
from config import *
from Console import *
from XenDevice import *
+from acm import *
BLOCK_ROOT_DEV = "hda"
self.defaultOpts["vif"] = []
self.defaultOpts["vtpm"] = []
if isACMEnabled():
- self.defaultOpts["access_control"] = []
+ #A default so every VM can start with ACM enabled
+ self.defaultOpts["access_control"] = ['policy=xm-test,label=red']
self.opts = self.defaultOpts
output = file(filename, "w")
output.write(self.toString())
output.close()
+ ACMPrepareSystem(self.opts)
def __str__(self):
"""When used as a string, we represent ourself by a config
ACM_LABEL_RESOURCES = False
labeled_resources = {}
-acm_verbose = False
+acm_verbose = True
def isACMEnabled():
return security.on()
"Start the system without any policy.\n%s" %
(policy, o))
+def ACMPrepareSystem(resources):
+ if isACMEnabled():
+ ACMLoadPolicy()
+ ACMLabelResources(resources)
+
+def ACMLabelResources(resources):
+ for k, v in resources.items():
+ if k == "disk":
+ for vv in v:
+ res = vv.split(',')[0]
+ ACMLabelResource(res)
# Applications may label resources explicitly by calling this function
def ACMLabelResource(resource, label='red'):
import time
from XmTestLib import *
+from acm import *
import xen.util.blkif
def block_attach(domain, phy, virt):
+ ACMLabelResource(phy)
status, output = traceCommand("xm block-attach %s %s %s w" %
(domain.getName(), phy, virt))
if status != 0:
unsafe=no
GROUPENTERED=default
+cp -f tests/security-acm/xm-test-security_policy.xml /etc/xen/acm-security/policies
+
# Resolve options
while [ $# -gt 0 ]
do